package com.ruoyi.web.StateDemo.service.impl;

import org.springframework.stereotype.Component;

@Component
public abstract class AbstractOrderState implements OrderState{

    private  RuntimeException runtimeException=new RuntimeException("该状态不支持");

    /**
     * 默认状态下都是不允许的操作
     */

    @Override
    public void paidEvent(ContextState contextState) {
        throw runtimeException;
    }

    @Override
    public void cancelOrderEvent(ContextState contextState) {
        throw runtimeException;
    }

    @Override
    public void verificationEvent(ContextState contextState) {
        throw runtimeException;
    }

    @Override
    public void applyRefundEvent(ContextState contextState) {
        throw runtimeException;
    }

    @Override
    public void finshedRefundEvent(ContextState contextState) {
        throw runtimeException;
    }

    /**
     * 处理退款操作
     * @param contextState
     */
    @Override
    public void doRefundEvent(ContextState contextState){
        throw runtimeException;
    }
}
